package com.xique.park.bean.transform.web.records;

import com.alibaba.excel.converters.Converter;
import com.alibaba.excel.enums.CellDataTypeEnum;
import com.alibaba.excel.metadata.CellData;
import com.alibaba.excel.metadata.GlobalConfiguration;
import com.alibaba.excel.metadata.property.ExcelContentProperty;
import lombok.NoArgsConstructor;

/**
 * 支付状态转换
 *
 * @author WLD
 */
@NoArgsConstructor
public class PayStatusConverter implements Converter<String> {

    @Override
    public Class<String> supportJavaTypeKey() {
        return String.class;
    }

    @Override
    public CellDataTypeEnum supportExcelTypeKey() {
        return CellDataTypeEnum.STRING;
    }

    @Override
    public CellData<String> convertToExcelData(String value, ExcelContentProperty excelContentProperty, GlobalConfiguration globalConfiguration) {
        switch (value) {
            case "1":
                return new CellData<>("待支付");
            case "2":
                return new CellData<>("已支付");
            case "3":
                return new CellData<>("正在支付中");
            case "4":
                return new CellData<>("已取消");
            case "5":
                return new CellData<>("无需支付");
            case "6":
                return new CellData<>("现金已支付");
            case "7":
                return new CellData<>("免费放行");
            case "20":
                return new CellData<>("全部退款");
            case "21":
                return new CellData<>("部分退款");
            default:
                return new CellData<>("未知");
        }
    }

    @Override
    public String convertToJavaData(CellData cellData, ExcelContentProperty excelContentProperty, GlobalConfiguration globalConfiguration) {
        return null;
    }
}
